home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / asm_subr.arc / SETPT < prev    next >
Encoding:
Text File  |  1985-10-01  |  2.1 KB  |  67 lines

  1. ;-------------------------routine begins--------------------------+
  2. ; ROUTINE FOR plotting a point on med-res color screen
  3. ;
  4. ; FUNCTION: This routine plots a point on the medium resolution
  5. ; color screen.  The pixel at the specified location is given a
  6. ; specified color, overwriting the old color.
  7. ; INPUT: Upon entry:
  8. ;        x-coordinate (0-319) of the point is in SI
  9. ;     y-coordinate (0-199) of the point is in DI
  10. ;     color (0-3) is in DX
  11. ; OUTPUT: Just to the screen
  12. ; REGISTERS USED:  No registers modified.  SI,DI,DX are used for
  13. ;                  input.
  14. ; SEGMENTS REFERENCED:  Upon entry ES: must point to the video RAM
  15. ; at B8000h and DS: must point to a data segment containing the fol-
  16. ; lowing look-up table of rotated color masks:
  17. ;
  18. ctable    dw    0003Fh,0403Fh,0803Fh,0C03Fh
  19.     dw    000CFh,010CFh,020CFh,030CFh
  20.     dw    000F3h,004F3h,008F3h,00CF3h
  21.     dw    000FCh,001FCh,002FCh,003FCh
  22. ;
  23. ; ROUTINES CALLED:  None
  24. ; SPECIAL NOTES: No bounds checking is performed.  The user must
  25. ; make sure that the coordinates and the color are in the proper
  26. ; ranges.
  27. ;
  28. setpt    proc    far
  29. ;
  30.     push    bx        ; save registers
  31.     push    si
  32.     push    ax
  33. ;
  34. ; multiply y-coord by bytes per row and adjust for even/odd lines
  35.     mov    ax,di        ; get y-coord into low part
  36.     mov    ah,al        ;   and into high part.
  37.     and    ax,01FEh    ; mask off unwanted parts
  38.     sal    ax,1        ; times 41
  39.     sal    ax,1        ; times 8
  40.     sal    ax,1        ; times 16
  41.     mov     bx,ax        ; goes into adddress
  42.     and    bx,7        ; without adjustment
  43.     sal    ax,1        ; times 32
  44.     sal    ax,1        ; times 64
  45.     add    bx,ax        ; adress gets y-coord times 80
  46. ;
  47. ; compute rotated mask and color
  48.     and    si,3        ; adjust pixel position into the index
  49.     sal    si,1        ; index times 2
  50.     sal    si,1        ; index times 4
  51.     add    si,dx        ; 4*pixel position + color
  52.     sal    si,1        ; 8*pixel position + 2*color
  53.     mov    ax,ctable[si]    ; look up rotated color mask
  54. ;
  55. ; insert color into the video byte
  56.     and    al,es:[bx]    ; get the old byte and remove old pixel
  57.     or    al,ah        ; insert new color
  58.     mov    es:[bx],al    ; put the byte back
  59. ;
  60.     pop    ax        ; restore registers
  61.     pop    si
  62.     pop    bx
  63.     ret            ; return
  64. ;
  65. setpt    endp
  66. ;-------------------------routine ends---------------------------+
  67.